﻿using FreeSql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyFreeSql
{
    public class FreesqlRepository<TEntity> : IFreesqlRepository<TEntity> where TEntity : class
    {
        private readonly IBaseRepository<TEntity> _repository;
        private readonly IFreeSql _freeSql;
        public FreesqlRepository(IFreeSql freeSql,IBaseRepository<TEntity> baseRepository)
        {
            _repository = baseRepository;
            _freeSql = freeSql;
        }
        public List<T> GetList<T>() where T : class
        {
            return _freeSql.Select<T>().ToList();
        }

        public void Insert(TEntity entity)
        {
            _repository.Insert(entity);
        }
    }
}
